<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <script>
        function* foo(x) {
            var y = x * (yield);
            yield y;
            var a = (yield) + "";
            yield "y" + a;
            return "lala";
        }

        var it = foo(6);
        // 启动foo(..)
        it.next();
        var res = it.next(7);
        console.log(res.value);
        it.next();
//        var b = it.next("1");
        console.log(it.next("1").value);

    </script>
</body>
</html>